<template>
	<view class="container">
		
		
		<!-- 第一步 -->
		<view class="doc-info-head">
			<view class="doc-info-head-img">
				<text class="doc-info-head-tTxt">头像</text>
				<view class="doc-info-head-img-avatar">
					<image :src="avatar"></image>
				</view>
			</view>
			
			
			
			<view class="doc-info-head-t">
				<view class="doc-info-head-tTitle">
					<text class="doc-info-head-tTitleNav">个人信息</text>
				</view>
				<view class="doc-info-head-tname">
					<text class="doc-info-head-tTxt">姓名</text>
					<view class="doc-info-head-tipt">
						{{nickname}}
					</view>
				</view>
				<view class="doc-info-head-tname">
					<text class="doc-info-head-tTxt">医院</text>
					<view class="doc-info-head-tipt">
						{{hospital_name}}
					</view>
				</view>
				<view class="doc-info-head-tname">
					<text class="doc-info-head-tTxt">科室</text>
					<view class="doc-info-head-tipt">
						{{department_name}}
					</view>
				</view>
				<view class="doc-info-head-tname">
					<text class="doc-info-head-tTxt">职称</text>
					<view class="doc-info-head-tipt">
						{{title}}
					</view>
				</view>
			</view>
			<view class="doc-info-head-intr">
				<view class="doc-info-head-tTitle">
					<text class="doc-info-head-tTitleNav">个人简介</text>
				</view>
				<view class="doc-info-head-intrmore">
					<textarea class="doc-info-head-intrmoreTxt" v-model="bio" maxlength="300" placeholder-style="color:#BCC1CC" placeholder="请输入个人简介" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import app from '../../App.vue'
	 export default {
	    data() {
	      return {
			  docId:'',
			  nickname:'',
			  avatar:'',
			  title:'',
			  bio:'',
			  hospital_name:'',
			  department_name:'',
			}
	    },
		onLoad(options) {
			this.docId = options.id
			this.getinfo()
		},
	    methods: {
			getinfo(){
				let that = this,
				data = {
					user_id : that.docId
				}
				app.post('api/user/info',data).then(res=>{
					if(res.code == 1){
						console.log(res.data.avatar)
						that.nickname = res.data.nickname
						that.avatar = res.data.avatar
						that.title = res.data.title
						that.bio = res.data.bio
						that.hospital_name = res.data.hospital_name
						that.department_name = res.data.department_name
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							mask: true
						})
					}
				}).catch(err=>{
					uni.showToast({
						title: err.msg,
						icon: 'none',
						mask: true
					})
				})
			}
	    }
	  }
</script>

<style>
	@import url("../../common/docinfo.css");
	.doc-info-head-img{
		width: 100%;
		padding: 32rpx;
		box-sizing: border-box;
		margin-bottom: 32rpx;
		background-color: #FFFFFF;
		border-radius: 32rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	.doc-info-head-img-avatar{
		width: 88rpx;
		height: 88rpx;
	}
	.doc-info-head-img-avatar image{
		width: 100%;
		height: 100%;
	}
</style>
